package com.zy.springSecurity.controller;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

@Controller
public class GongfuController {
	
	@GetMapping("/level1/{path}")
	public String leve1Page(@PathVariable("path")String path){
		return "/level1/"+path;
	}
	@GetMapping("/level1/1")
	@PreAuthorize("hasRole('学徒') and hasAnyAuthority('putong:putong') ")
	public String leve1Page1(){
		return "/level1/1";
	}
	@GetMapping("/level1/2")
	@PreAuthorize("hasRole('学徒') and hasAnyAuthority('aaaa') ")
	public String leve1Page2(){
		return "/level1/2";
	}
	@GetMapping("/level1/3")
	@PreAuthorize("hasRole('学徒') and hasAnyAuthority('putong:wudang') ")
	public String leve1Page3(){
		return "/level1/3";
	}
	
	@GetMapping("/level2/{path}")
	public String leve2Page(@PathVariable("path")String path){
		return "/level2/"+path;
	}
	
	@GetMapping("/level3/{path}")
	public String leve3Page(@PathVariable("path")String path){
		return "/level3/"+path;
	}
	@GetMapping("/leve4/{path}")
	public String leve4Page(@PathVariable("path")String path){
		return "/leve4/"+path;
	}

}
